import scrapy
from urllib.parse import quote
from selenium import webdriver
import arrow
import re

class SearchSpider(scrapy.Spider):
    name = "search"
    # handle_httpstatus_list = [404]
    # download_delay = 2
    # strat_urls = []

    def start_requests(self):
        # urls = [
        #     'http://quotes.toscrape.com/page/1/',
        #     'http://quotes.toscrape.com/page/2/',
        # ]
        # for url in urls:
        #     yield scrapy.Request(url=url, callback=self.parse)
        url = "http://news.baidu.com/ns?word=%s&pn=%s&cl=2&ct=0&tn=news&rn=50&ie=utf-8&bt=0&et=0"
        keys = ["海外业务","海外营收","海外获利","海外用户","海外并购","海外收购","海外合资","海外子公司","海外市场","海外战略","海外策略","国际化战略","国际化策略","新兴市场战略","新兴市场策略",]
        coms = ["海虹控股","神州信息","天夏智慧","智度股份","长城动漫","中信国安","茂业通信","电广传媒","南天信息","高升控股","新大陆","远光软件","东华软件","凯瑞德","国脉科技","生意宝","天润数娱","梦网集团","利欧股份","麦达数字","北纬科技","石基信息","游族网络","东方网络","二三四五","科大讯飞","启明信息","天威视讯","川大智胜","拓维信息","卫士通","久其软件","联络互动","中电鑫龙","焦点科技","键桥通讯","皖通科技","天神娱乐","北讯集团","太极股份","千方科技","中远海科","四维图新","广联达","达实智能","凯撒文化","启明星辰","晨鑫科技","众应互联","二六三","榕基软件","恺英网络","金财互联","杰赛科技","三七互娱","巨人网络","捷顺科技","艾格拉斯","完美世界","荣之联","博彦科技","中科金财","真视通","久远银海","德生科技","中新赛克","润建通信","神州泰岳","立思辰","网宿科技","银江股份","华星创业","宝通科技","同花顺","超图软件","梅泰诺","星辉娱乐","赛为智能","天源迪科","世纪鼎利","三五互联","中青宝","东方财富","华平股份","数字政通","银之杰","易联众","高新兴","乐视网","顺网科技","世纪瑞尔","东方国信","迪威迅","万达信息","汉得信息","捷成股份","东软载波","美亚柏科","天泽信息","易华录","上海钢联","拓尔思","银信科技","方直科技","明家联合","天玑科技","新开普","卫宁健康","佳创视讯","华宇软件","梅安森","海联讯","飞利信","朗玛信息","荣科科技","三六五网","蓝盾股份","富春股份","汉鼎宇佑","同有科技","宜通世纪","任子行","邦讯技术","掌趣科技","旋极信息","华虹计通","兆日科技","润和软件","联创互联","长亮科技","华鹏飞","北信源","全通教育","恒华科技","创意信息","绿盟科技","赢时胜","鼎捷软件","东方通","安硕信息","光环新网","飞天诚信","腾信股份","京天利","昆仑万维","浩丰科技","暴风集团","运达科技","浩云科技","创业软件","高伟达","迅游科技","四方精创","信息发展","润欣科技","盛天网络","中科创达","维宏股份","恒泰实达","盛讯达","科大国创","辰安科技","博思软件","今天国际","冰川网络","先进数通","新晨科技","和仁科技","万集科技","丝路视觉","佳发安泰","中富通","汇金科技","平治信息","会畅通讯","数字认证","熙菱信息","吉大通信","诚迈科技","立昂技术","恒锋信息","思特奇","汇纳科技","富瀚微","万兴科技","彩讯股份","正元智慧","中孚信息","科蓝软件","富满电子","中科信息","朗新科技","赛意信息","科创信息","奥飞数据","歌华有线","中国联通","中昌数据","ST信通","国旅联合","国电南瑞","华胜天成","金证股份","湘邮科技","中国软件","ST慧球","恒生电子","信雅达","用友网络","云赛智联","富控互动","东方明珠","*ST中安","游久游戏","工大高新","东软集团","佳都科技","浪潮软件","浙大网新","鹏博士","广电网络","宝信软件","华东电脑","大晟文化","广西广电","江苏有线","科达股份","贵广网络","三六零","*ST智慧","吉视传媒","人民网","泛微网络","海量数据","网达软件","格尔软件","电魂网络","超讯通信","*ST运盛","顶点软件","鼎信通讯","吉比特","掌阅科技","中通国脉","纵横通信","南威软件","华扬联众","数据港","新华网","金桥信息","麦迪科技","中科软","指南针","盖特佳","胜龙科技","海鑫科金","金和网络","北科光大","林克曼","凯英信业","科瑞讯","圣博润","建设数字","九恒星","国学时代","达通数据","中海纪元","中科国信","金山顶尖","南北天地","维信通","亿创科技","兆信股份","德鑫物联","道隆软件","尚水股份","中科联众","新锐英诚","爱迪科森","同辉信息","航星股份","合力思腾","爱特泰克","中交远洲","中矿华沃","航天理想","金润科技","汉唐自远","广厦网络","卡联科技","伟利讯","润天股份","智立医学","科能腾达","思银股份","康辰亚奥","腾龙电子","北方科诚","三泰晟驰","光谷信息","一正启源","博维仕","融智通","中教股份","点点客","白虹软件","全网数商","北方跃龙","奥贝克","新瑞理想","波尔通信","东展科博","微传播","宣爱智能","时代地智","腾实信","石竹科技","优炫软件","乐升股份","一鑫达","网动科技","东软慧聚","天房科技","ST赛诺达","普华科技","奥特美克","智网科技","光电高斯","联宇技术","兴竹信息","中幼教育","卓繁信息","易同科技","易维科技","神州云动","盛世光明","恒信启华","新网程","锐创信通","威达宇电","和隆优化","金硕信息","量化科技","维珍创意","扬讯科技","达美盛","众联信息","巨灵信息","精英智通","元工国际","百林通信","中环系统","安华智能","普康迪","银音科技","呈创科技","优网科技","地大信息","慧网通达","雷腾软件","东电创新","明波通信","捷安高科","英富森","星立方","中科网络","英思科技","长合信息","帝信科技","中电方大","地林伟业","长城软件","飞田通信","数聚股份","英极股份","和航科技","蓝泰源","恒锐科技","德联科技","陆海科技","方迪科技","深圳行健","哲达科技","安泰得","辰维科技","求实智能","普金科技","东创科技","华博胜讯","奥远电子","亚奥科技","远大教科","芯朋微","麟龙股份","欧丽信大","闽保股份","畅想高科","大方软件","新华通","安运科技","华宇股份","天润科技","星奥股份","迈科网络","泰信电子","力龙信息","云天软件","国贸酝领","金瑞科技","中磁视讯","瀚远科技","腾晖科技","凯立德","国科海博","合胜科技","景格科技","映翰通","蓝科泰达","群雁信息","同望科技","楼兰股份","大陆股份","联合永道","东芯通信","一卡易","浩海科技","宝石金卡","同智伟业","九五智驾","金格科技","源渤科技","全岛互联","帛仁旅游","四联智能","永鹏科技","奥派股份","艾融软件","致生联发","芯邦科技","奥特股份","金诺科技","瑞华天健","诚思科技","凌志软件","建策科技","长信畅中","深拓智能","海魄科技","轩辕网络","海迈科技","成聪软件","安证通","网波股份","兆久成","北方数据","科明数码","惠当家","微步信息","道一信息","先临三维","领意信息","岳能科技","海联捷讯","华雁信息","熙浪股份","兴致体育","卓华信息","天喻软件","中瀛鑫","远古信息","安泰股份","鑫干线","北塔软件","瑞聚股份","中鼎科技","东润环能","绿网天下","中网科技","思为同飞","埃林哲","金科信息","智明恒","优粒智寓","易销科技","元鼎科技","领信股份","科润智能","易讯通","全维技术","众智软件","彩通科技","派拉软件","恒扬数据","博华科技","尚恩科技","宏景软件","平方科技","一铭软件","同力天合","金视和","蛙视通信","启奥科技","安美勤","数字认证","上海零动","丽明股份","华博教育","博安智能","安畅网络","海典软件","信易科技","朗悦科技","华奥科技","竞天科技","木联能","中电智能","帜扬信通","华创网安","许昌智能","赞普科技","万泰中联","华油科技","天际航","中创股份","数据堂","创力股份","沃顿股份","伟诚科技","世窗信息","德柏教育","天际数字","和信基业","汇通华城","成电光信","中联信通","事成股份","学府信息","能龙教育","艾倍科","美林数据","中呼科技","光辉互动","鸿业科技","科致电气","威科姆","易建科技","博达软件","博安达","金鹏信息","盛景科技","富深协通","亿恩科技","山大地纬","三高股份","黔驰信息","工大软件","创泽信息","瀚特信息","青鸟软通","虎符智能","邦正科技","三木科技","智华信","微企信息","广新信息","山源科技","智冠股份","同方软银","科达自控","分豆教育","海誉科技","畅想软件","成达兴","鱼鳞图","云智科技","长潮股份","远大信息","汇川科技","天立泰","长宝科技","中科云巢","建研信息","上海亿格","佳音在线","维森信息","大道信通","东方基业","纵横宝盈","博涛文化","科雷特","中兴通科","高健实业","天安智联","东联科技","爱科赛","万古科技","现在支付","清科股份","浩辰软件","泰利思诺","浩亚股份","中设智控","达能电气","亨达科技","网智天元","中爆数字","华网智能","云宏信息","新为股份","软智科技","德毅科技","志晟信息","博晟安全","宏晶科技","华科飞扬","安正科技","普点科技","瑞特科技","诺君安","龙图信息","佳时达","天维尔","广安车联","汉能华","广通股份","捷尚股份","海颐软件","高士达","动脉智能","一保通","英伦信息","慧图科技","格瑞光电","微缔软件","德尔智能","旭海科技","福昕软件","科海股份","国农基业","刻度信息","普罗米新","金蓝络","珠海港信","明源软件","华鼎科技","尚洋信息","鸿普森","元丰科技","京成科技","金软科技","三川田","大商帮","盈嘉科技","蓝海科技","云迅通","同兴股份","观想科技","精英科技","天禹星","数码大方","中安股份","铱迅信息","金智教育","预言软件","大运科技","确信信息","讯众股份","金点物联","优力克","蓝太平洋","未名信息","竹林松大","数亮科技","贵仁科技","像素数据","育星达","东鼎股份","时代凌宇","思晗科技","华信股份","诺伊曼","百胜软件","景心科技","天润基业","瑞风协同","施泰信息","景安网络","大洋信息","爱可生","寰烁股份","雨来科技","多邦科技","伟乐科技","国通亿创","银科金典","赛特斯","身临其境","电旗股份","军芃科技","达尔智能","地球村","瑞晟智能","深捷科技","紫光通信","浩瀚股份","紫荆股份","正方股份","西奥科技","汉尧环保","鼎讯股份","意畅科技","益盟股份","创识科技","悦居智能","道尔智控","思亮信息","怡林实业","力软科技","法本信息","东华宏泰","开拓明天","宁冠鸿","欣智恒","精英天成","鹏信科技","立方控股","大唐融合","欣威视通","通用数据","顺治科技","立翔科技","亿联科技","优万科技","捷玛信息","仰邦科技","融都科技","灵犀金融","ST天智","同方健康","亿能达","富煌科技","华生基因","佑康股份","威尔克","软汇科技","国路安","骏环昇旺","军一物联","东忠科技","北亚时代","丽晶软件","悦高软件","久康云","方胜有成","中诚股份","金盾软件","胜软科技","亿阳值通","东尚信息","朗尼科","锐融科技","手付通","凡拓创意","电庄股份","联达动力","云朵网","特力惠","泰聚泰","点动股份","硕达科技","美特安全","世纪金政","微瑞思创","光大教育","视纪印象","神玥软件","湾流股份","威尔数据","新翔科技","华南信息","施勒智能","中诺思","蓝擎股份","爱知之星","金尚互联","华特信息","网班教育","佰聆数据","合力亿捷","汇通金融","瀚高股份","天力软件","易康云","吉联新软","新道科技","森井科技","创建达一","棠棣信息","递蓝科","骅锋科技","金信瑞通","康威通信","精讯科技","中新股份","嘉友互联","神州锐达","浩腾科技","新视野","狂龙数字","携宁科技","景云祥","清软创新","宝润兴业","时光科技","卓信数据","阿尔创","远图互联","三维天下","融安特","火谷网络","嘉诚信息","盈丰软件","华发教育","普菲特","易构软件","赛思信安","龙盛世纪","清众科技","金锐同创","蓝灯数据","金通科技","新智视讯","高信达","云端网络","太极云软","软脑科技","时代亿信","立晨数据","博芯科技","亿芯源","安盛科技","阿拉科技","龙贝世纪","工大高科","实邑科技","大娱号","展芯微","纵横六合","华澜微","ST东方数","和创科技","华畅科技","中广瑞波","天利和","神鹰城讯","上讯信息","科旭网络","ST数腾","西麦科技","培诺教育","数智源","神州科技","赛思软件","开运联合","慧云股份","绿度股份","融航信息","杭州掌盟","锐志天宏","富友昌","冠新软件","锐英科技","龙软科技","华腾科技","华路时代","亿美汇金","国科股份","赛融信","傲冠股份","海格尔","孔诚物联","凯莱特","易简集团","兰德网络","元年科技","蓝卡科技","蓝色星球","萨纳斯","曼恒数字","鸿冠信息","思维实创","华多科技","国鸿科技","微标科技","残友软件","创智信科","开维教育","拜特科技","颗豆互动","通铭教育","宝利明威","乐程科技","楚誉科技","之维安","名传股份","开眼数据","华夏科技","国舜股份","征途科技","鑫考教育","默联股份","爱迪科技","光庭信息","赛科科技","中盈安信","联君科技","创谐信息","三棱股份","迈新科技","伯瑞信息","清鹤科技","邦业科技","柏科咨询","图安世纪","云畅游戏","飞搏软件","飞企互联","贝博电子","荣程创新","紫越科技","鸿翼股份","维尔达","帝隆科技","络捷斯特","华腾教育","博宇科技","延边创业","炫伍科技","琴海数码","智臻智能","科脉技术","华尊科技","泰华智慧","关键科技","宝亮股份","高达软件","三好教育","人合机电","安杰信","盈放科技","英飞网络","国信同科","挪瑞科技","互普股份","清睿教育","海泰方圆","锐迅股份","曼荼罗","麦驰物联","英诺威尔","欧歌科技","毅通股份","莲合科技","圣世博泰","瀚易特","华大股份","竹远科创","墨麟股份","慧达通信","沃科合众","讯腾智科","快拍物联","万联网络","世纪坐标","金马扬名","南自股份","未来国际","琥崧智能","时讯立维","鑫联华","国源科技","颐信泰通","亚微软件","众诚科技","福信富通","日华科技","真灼科技","泰克贝思","云晖航科","数图科技","客如云","华软新元","同是科技","鹏业软件","力尊信通","ST众鼎","昆腾微","云创数据","龙的股份","华创股份","搜搜电商","创星科技","壹进制","金网信息","安软科技","明朝万达","正安维视","量邦科技","今晚网络","腾信软创","中感微","够快科技","亿同科技","慧典云医","微卓科技","迈思汇智","软素科技","因尚网络","智玩网络","殷图网联","康铭泰克","东晨联创","中科汇联","蓝创智能","七洲科技","中宇万通","筑想科技","思智泰克","汇生通","无锡优拓","中鼎恒信","华志信","蓝深远望","天润融通","天亿马","凌之迅","数字人","鑫创佳业","帝杰曼","安之畅","西普数据","信源信息","海森电子","天好电子","睿易教育","卡莱博尔","匡信科技","凯风技术","日月明","财人汇","微网信通","奕通信息","纵横科技","用尚科技","安明斯","博大光通","视美泰","智铸科技","胄天科技","明动软件","皿鎏软件","资旗源","蓝网科技","圣目股份","尚阳股份","侏罗纪","格林披治","虎符科技","柠檬网联","天诚安信","钜泉光电","茂昂智能","安人股份","诺博教育","云端时代","随锐科技","朋万科技","博易创为","昆仑股份","信元网安","思锐股份","时代正邦","天睿空间","瑞安科技","思贤股份","华浩科技","北鹰科技","君逸数码","三开科技","华青融天","智慧眼","控创信息","中迪医疗","国芯科技","博思汇众","映潮科技","厚泰科技","网博视界","易信成","品茗股份","亚讯星科","吉星智能","正源中溯","寰旗科技","恩普特","卡友信息","泰宇信息","比特耐特","高正信息","信通捷","中科恒运","兴和云网","易云股份","动易软件","网盛数新","海天炜业","实为信息","黄金屋","博为软件","感信信息","耐维思通","新亚股份","北科软件","博为峰","北森云","小桥流水","汇春科技","矩阵软件","安怀信","益信通","伊登软件","群智合","四方博瑞","风云科技","博岳股份","华成智云","正辰科技","九言科技","支点科技","宝利软件","太极华保","名通科技","ST协能","佰信蓝图","商客通","博达股份","芯联达","万佳科技","视酷股份","华泓科技","捷思锐","友声科技","三茗科技","瑞星网安","艾迪普","考拉超课","智乐园","正迪科技","安正软件","金牛物联","摩艾客","网博科技","鑫日科","ST紫极","科睿特","ST掌柜","雕龙数据","亿友慧云","远行科技","皓华网络","中裕广恒","三联交通","盛邦安全","优通科技","康利物联","集时股份","亭联科技","中达金桥","华信科泰","朝阳股份","易家科技","金晟科技","嘉德永丰","睦合达","依能科技","铼钠克","瑞信杰创","智远科技","千盟智能","星盾科技","宇田科技","爱用宝","山维科技","翔晟信息","裕源大通","金至科技","恒达时讯","盈迪信康","百灵电子","万华金慧","源启科技","鼎集智能","智盛信息","上海功途","赛四达","三正股份","益模科技","超清股份","置诚管网","新时空","广州瀚润","赛诺科技","敬众科技","浪潮创新","宏祥智能","博校科技","汇通科技","华建云鼎","华如科技","汉亦盛","梯升股份","金佳园","柏科数据","清流股份","中水三立","中天亿信","天信科技","北斗信息","恒谦教育","十方通","峰盛科技","贝伦思","弘方科技","深蓝科技","天泽物网","集恩图造","华正明天","华软股份","巨安股份","众荟信息","益邦智能","特力通","中盈高科","冠群信息","联创信安","微诺时代","美房云客","道坦坦","万相融通","创远科技","识代运筹","国华云网","新豪智云","ST以太","电通物联","洁誉科技","宏涛嘉业","天禾软件","中博龙辉","天创物联","晨阑数据","奇智奇才","宙斯物联","会搜科技","能信科技","明博教育","昌恩智能","通宇泰克","雨诺股份","大道网络","华信永道","坦程物联","城市云","雨花石","晶奇网络","健坤通信","微柏软件","和信创天","润博电子","龙鼎源","汉威光电","恒锐智能","顺凯信息","思宇信息","安鸿科技","航天汇智","中泓在线","诚进科技","乐众信息","和润科技","路桥信息","天河智造","宏天信业","英泰伟业","图聚智能","讯美科技","中山爱科","金信德","派特森","联软科技","捷通华声","黑马高科","中普达","北科瑞声","仁歌股份","智浦芯联","中电科安","安盟网络","鼎商动力","捷视飞通","紫荆网络","数字动力","同创双子","览众科技","今科科技","佳缘科技","联著实业","广州欧科","天创信息","永霸信科","东领智能","车微联","天维信息","初唐科技","雷克斯","傲天科技","九天云竹","兴康信","通产智能","西屋股份","宇脉科技","噢易云","唯智信息","升思科技","大一科技","兆光科技","世昕股份","均岩科技","亿维集成","今奥科技","商信政通","佳邦信息","酷尾巴","弘信科技","尚为科技","意利科技","美莱创新","万霆科技","联凯科技","易普拉格","同步新科","索信达","历康科技","合众慧能","创元股份","九成信息","瑞德传媒","康泰电子","科码先锋","伟思国瑞","大账房","九州信泰","山谷网安","异瀚数码","星捷安","星汉信息","启翔景程","阳光三极","怀教网络","神州安信","特里尼斯","恒通云","达创科技","全景视觉","点景科技","盈联科技","红石阳光","科融数据","天锐股份","优景科技","未至科技","深思软件","宏景科技","云多科技","斯维尔","慧眼数据","中仿智能","商情数据","澳通电讯","鑫英泰","中讯创新","盛和信","山景股份","精华教育","思普科","东方信达","建业科技","泽鑫科技","奥一新源","博能股份","汇成教育","金软瑞彩","本贸科技","东方远景","钧普科技","蓝海讯通","万德信息","达意科技","月新科技","昊天诚泰","新图科技","思迅软件","迈拓港湾","三和软件","荣尧智慧","中天健康","晨曦科技","华天海峰","朗天通讯","五道口","仁润股份","科旭威尔","德讯科技","卓展科技","瀚正科技","博远容天","品聚网络","博科思","鑫亿软件","智趣互联","好房通","讯联股份","数字方舟","辽联电商","广脉科技","嘉华汇诚","叙简科技","互盟科技","太比雅","星震同源","迈特望","运时数据","博导股份","求实股份","钜芯集成","天勤盛创","九索数据","维纳软件","国讯股份","莱诺斯","腾盛智能","探索者","弘扬软件","中研宏科","快商通","久源软件","凯普顿","启程科技","天意天映","华会通","恒电科技","珠海鸿瑞","科创融鑫","惠岚科技","甲骨文","小乙物联","华叶跨域","多元世纪","欣网科技","艾派科技","ST承蓝","荣德铵家","盛世全景","飞嘀智慧","华创方舟","丰瑞祥","圣剑网络","圣点科技","里定医疗","中城数据","有明云","泽达易盛","凯奇谷","赛若福","魔品科技","海辰科技","嘉利通","金禾软件","华移科技","微云科技","羽星股份","一品嘉","高德唯斯","悦诚达","步速者","伟思创","森锐科技","瑞岚卓越","智能交通","帮安迪","天懋信息","联合信息","中亚通茂","海达信通","海高通信","国瑞数码","三友和","晟烨股份","中锐网络","兴融联","唐人科技","臻云股份","力石科技","百得科技","中琛源","杉工智能","久良科技","红点智能","华电网络","和宁信息","移联创","长城网科","亦云信息","健新科技","泰鸿科技","创新安全","振业优控","麦亚信","鸣泰信息","瑞普科技","易网股份","金互通","大宇信息","中科鼎创","中科博润","用友金融","信联股份","同步天成","七通网络","并行科技","中电科技","传奇华育","绛门科技","泽华伟业","通普股份","天筑科技","碧驰股份","信邦科技","护航科技","金鑫股份","至胜科技","天佑科技","诚高科技","凯泽科技","利丰智能","腾燊嘉诚","德信科技","君信达科","金橙子","卓信科技","安博通","和美信息","佳维科技","力通科技","杰迈科技","德通股份","捷鑫网络","华盖科技","芯软科技","威星电子","博通影音","鹍骐科技","鼎圣科技","医微讯","明厚天","田龙电气","艾莫基","帕科科技","广道高新","奥迪安","天优科技","诚道科技","宇创世纪","探感科技","创至股份","鸥玛软件","申立股份","思诺博","联迪信息","赛姆科技","恒宇科技","微核科技","美福科技","亿德力","沃趣科技","大国慧谷","中广通业","群志科技","黑马软件","信昇达","倚天软件","钛能科技","宇翊股份","智通股份","用友汽车","中祥科技","众联科技","锐网科技","龙存科技","达峰智能","中关股份","天标科技","国民软件","昂科信息","新迎顺","盈力科技","博源恒芯","艾策通讯","速度信息","宏灿股份","经纬天地","京福安","思源股份","三好股份","云图动漫","复深蓝","创旗天下","启臣电子","新视云","威恒股份","赛欧必弗","中创互动","东富智能","北科天翼","锐驰鼎欣","加滋杰","昂捷信息","通得科技","极致科技","泰茂股份","卓识网安","经纬视通","三佳股份","极天信息","易付金服","申朴信息","骄阳视创","盛灿科技","信核数据","巨龙股份","寅酷网络","艾力泰尔","汉云信息","成享软件","华夏明科","普罗格","启明股份","智鑫博达","中网信息","蓝凡科技","金税股份","艾迪艾思","博雅智学","辉宏世纪","亿能科技","优创新港","恒域股份","爱尚游","金名股份","斯欧信息","中科巨龙","宏银信息","蒙古文化","科友股份","通达电气","金东创意","西诚软件","飞瑞敖","卫星定位","天大天科","海存志合","智慧环思","恒泰智联","紫软数据","金科交通","易聆科","泰德网聚","美诺科技","红岭云","迪浪科技","首信科技","领瑞达","花儿绽放","英讯通","上古彩","点春科技","融海数据","季丰电子","新中大","讯商科技","凯通科技","唐音股份","北辰德","校宝在线","精标科技","中标数据","良讯股份","南大先腾","万联科技","方天股份","赣通通信","江河股份","安钢软件","晟融数据","博智信息","佳锐科技","维数软件","数策股份","星舟科技","精点数据","羽实箫恩","赛诚智慧","科曼信息","振宁科技","世纪风","高信股份","华泰信息","乾云科技","美林通","扬讯技术","好易信息","红有软件","鼎欣科技","开普云","华信智能","华信泰","聚房宝","前沿信安","东微智能","时尚百联","中科数联","上海中兴","慧捷科技","航标视讯","竞远安全","溢信科技","中百信","天程科技","穿越科技","心海导航","和索信息","同岩科技","东智股份","博通信息","中创智慧","上海大漠","天华信息","商动力","光速达","欣横纵","安盟信息","人脉信息","软都科技","太亚科技","休恩科技","中科希望","银商股份","北斗城际","创能科技","热点股份","高新现代","网格天地","锐驰瑞德","融信通","华育智能","宏创科技","蚁坊软件","金蝶天燕","少数派","蓝耘科技","高盛信息","汇鑫科技","交大思诺","国云科技","二乘三","鼎讯科技","峰华铁信","源和智能","成名科技","合力创新","中科动漫","广凌科技","必安必恒","致信信息","五洋通信","银达信息","华运通","君立华域","华威科","继元科技","博约科技","光电安辰","思普达","百灵科技","微图软件","中财信","哈工大业","叠云股份","志诚信息","太湖云","甲子股份","沈信股份","芮森鑫服","天奕股份","紫云股份","万雍科技","金恒博远","莞银股份","艺恩数据","捷佳润","恒天凡腾","华魏科技","瘦课教育","科海电子","明大启微","华大天元","瑞意博","新柏石","索云科技","中望软件","鼎义互联","精英在线","盈通股份","奥博信息","灵智自控","智卓信息","永乐数码","精诚以诺","兴达软件","漫道图像","云基物宇","德融嘉信","华盈智能","星桥股份","掌中飞天","盛迅信息","六合股份","一安高新","丽正软件","多闻科技","爱刷科技","梅花软件","迪维信达","佳诚弘毅","汇通合力","南亿科技","伟岸纵横","广信安","爱护网","美嘉林","信新智本","创源通信","音明股份","联诚智胜","建邦软件","九门科技","金飞跃","光点互动","统领网络","绮耘股份","环球软件","爱韦讯","微想科技","银基安全","金视野","数安时代","联星股份","立标新智","中能达","天演维真","峰杰股份","飞硕科技","易时科技","粤峰高新","智云数据","逆火科技","中科新瑞","利泰科技","赛能科技","正中信息","微客巴巴","光耀电力","孔明科技","智信信息","思索股份","泰越科技","火柴盒","中苏科技","爱克信","昊华股份","谦讯网络","荣飞科技","祝融科技","智建科技","卓网信息","南大智慧","华博创科","精一科技","网进科技","鹏锐技术","华仿科技","位智天下","金硅科技","新烽光电","盛达科技","康明新","铭视科技","优天下","中智天弘","博宇信息","纵横智慧","瑞普股份","基理科技","联科云","泰得科技","青岛积成","慧峰科技","瀚天智能","怡联科技","上元智能","盛祺信息","维拓科技","凯特智控","久信信息","西信信息","思伟科技","融通股份","思源软件","通慧科技","宇德科技","科迪智能","桃子科技","网域科技","蓝水软件","城安科技","赛融科技","明易达","徐工信息","金恒科技","浩鸿达","中业股份","新域集成","麦歌恩","成利吉","快车科技","易方信息","智林股份","时代银通","格瑞特","浩天新杰","云华通","长河科技","智云创新","益诚嘉华","天远三维","大陆康腾","云康智能","医联网","融利科技","三源信息","仑谷科技","中联慧通","鼎旸股份","紫藤科技","经纬腾云","睦通科技","赫尔墨斯","三木众合","蓝典科技","万司股份","欢聚时代","凹凸科技","橡果国际","泰克飞石","上为集团","聚美优品","前程无忧","哔哩哔哩","联游网络","富基融通","环球资源","太宇机电","晶立","爱奇艺","凌动智行","陌陌","房天下","永新视博","华视传媒","唯品会","畅游","猎豹移动","联合信息","搜狐","UT斯达康","微博","阿里巴巴","人人","58同城","网易","新浪","世纪互联","百度","易车","途牛","携程","华米科技","中国信息技术","乐居","京东","中芯国际","迅雷","国双","旭明光电","汽车之家","500彩票网","凤凰新媒体","搜狗","金融界","中网载线","第九城市","蓝汛",]
        for name in coms:
            for kw in keys:

                key = "%s (%s)"%(name,kw)
                yield scrapy.Request(url% (key,0), callback=self.parse, meta={'_key':key, '_name': name, "_pn":0})

    def parse(self, response):
        def handle_date(lis):
            try:
                ss = lis.pop()
                ma = re.findall("(\w+)小时前", ss)
                if ma:
                    return arrow.now().shift(hours=-int(ma[0])).datetime
                return arrow.get(ss, "YYYY年MM月DD日 HH:mm", ).shift(hours=-8).to('local').datetime
            except IndexError:
                self.logger.error(lis)
                return None
            except Exception as e:
                return arrow.now().datetime

        _key = response.meta['_key']
        _name = response.meta['_name']
        _pn = response.meta['_pn']

        if "下一页>" in response.css('.n::text').extract():
            url = "http://news.baidu.com/ns?word=%s&pn=%s&cl=2&ct=0&tn=news&rn=50&ie=utf-8&bt=0&et=0"
            yield scrapy.Request(url % (_key, _pn+50), callback=self.parse, meta={'_key': _key, '_name': _name, "_pn": _pn+50})

        for each in response.css(".result"):
            url = each.css(".c-title a::attr(href)").extract_first()
            dic = dict()
            dic['title'] = "".join(each.css(".c-title a::text, .c-title a em::text").extract())
            dic['url'] = url if "?" not in url else url.split('?')[0]
            dic['auth_update'] = each.css(".c-author::text").extract_first()

            spt = dic['auth_update'].split('\xa0\xa0')
            if len(spt) == 2:
                dic['auth_format'] = spt[0]
            dic['update_format'] = handle_date(spt)
            dic['abstract'] = "".join(each.css(".c-summary::text, .c-summary div::text, .c-summary em::text").extract())
            dic['_key'] = _key
            dic['_name'] = _name
            yield dic

